home *** CD-ROM | disk | FTP | other *** search
/ Internet Info 1994 March / Internet Info CD-ROM (Walnut Creek) (March 1994).iso / inet / ien / ien-168 < prev    next >
Text File  |  1988-12-01  |  34KB  |  827 lines

  1.      IEN: 168
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.                     VAX-UNIX Networking Support Project
  11.                         Implementation Description
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.                              Robert F. Gurwitz
  28.                          Computer Systems Division
  29.                        Bolt Beranek and Newman, Inc.
  30.                             Cambridge, MA 02138
  31.  
  32.  
  33.                                January, 1981
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.      VAX-UNIX Networking                                 January, 1981
  61.      Support Project                                           IEN 168
  62.  
  63.  
  64.  
  65.      1  Introduction
  66.  
  67.           The purpose of this report is to describe the implementation
  68.      of network software for the VAX-11/780 * running UNIX. ** This is
  69.      being  done  as  part of the VAX-UNIX Networking Support Project.
  70.      The overall purpose of this effort is to provide  the  capability
  71.      for  the  VAX  to  communicate  with  other computers via packet-
  72.      switching networks,  such  as  the  ARPANET.   Specifically,  the
  73.      project  centers  around  an  implementation  of the DoD standard
  74.      host-host protocol, the Transmission Control Protocol (TCP)  [4].
  75.      TCP  allows communication with ARPANET hosts, as well as hosts on
  76.      networks outside the ARPANET, by its  use  of  the  DoD  standard
  77.      Internet  Protocol  (IP) [3].  The implementation is designed for
  78.      the VAX, running VM/UNIX, the   modified  version  of  UNIX  32/V
  79.      developed  at  the  University of California, Berkeley [1].  This
  80.      version of UNIX includes virtual paging capabilities.
  81.  
  82.           In the following paragraphs, we will discuss  some  features
  83.      and design goals of the implementation, and its organization.
  84.  
  85.  
  86.  
  87.      2  Features of the Implementation
  88.  
  89.      2.1  Protocol Dependent Features
  90.  
  91.      2.1.1  Separation of Protocol Layers
  92.  
  93.           The  TCP  software  that  we  are  developing  for  the  VAX
  94.      incorporates    several    important    features.    First,   the
  95.      implementation provides for separation of  the  various  protocol
  96.      layers  so  that  they  can  be accessed independently by various
  97.      applications. (1) Thus, there is a capability for access  to  the
  98.      TCP  level,  which  will provide complete, reliable, multiplexed,
  99.      host-host communications connections.  In addition, the IP  level
  100.      is also accessible for applications other than TCP, which require
  101.      its  internet  addressing   and   data   fragmentation/reassembly
  102.      services.   Finally,  the  implementation also allows independent
  103.      access to the local network  interface  (in  this  case,  to  the
  104.      ARPANET,  whose  host interface is defined in BBN Report No. 1822
  105.      _______________
  106.      * VAX is a trademark of Digital Equipment Corporation.
  107.      ** UNIX is a trademark of Bell Laboratories.
  108.      (1) In this context, the terms application and user refer to  any
  109.      software that is a user of lower level networking services. Thus,
  110.      programs such as FTP and TELNET can  be  considered  applications
  111.      when  viewed  from the TCP level, and TCP itself may be viewed as
  112.      an application from the IP level.
  113.  
  114.  
  115.  
  116.  
  117.                                     -1-
  118.  
  119.      VAX-UNIX Networking                                 January, 1981
  120.      Support Project                                           IEN 168
  121.  
  122.  
  123.  
  124.      [2])   in  a  "raw"  fashion,  for  software  which   wishes   to
  125.      communicate with hosts on the local network and do its own higher
  126.      level protocol processing.
  127.  
  128.  
  129.  
  130.      2.1.2  Protocol Functions
  131.  
  132.           Another feature of the implementation is to provide the full
  133.      functionality  of  each  level  of  protocol  (TCP  and  IP),  as
  134.      described in their specifications [3,4].  Thus, on the TCP level,
  135.      features   such   as   the   flow  control  mechanism  (windows),
  136.      precedence, and security levels will be  supported.   On  the  IP
  137.      level,  datagram  fragmentation and reassembly will be supported,
  138.      as well  as  IP  option  processing,  gateway-host  flow  control
  139.      (source-quenching)   and   routing   updates.    However,  it  is
  140.      anticipated that some of these  features  (such  as  handling  IP
  141.      gateway-host  routing  updates, and IP option processing) will be
  142.      implemented in later stages  of  development,  after  more  basic
  143.      features     (such     as     TCP    flow    control    and    IP
  144.      fragmentation/reassembly) are debugged.
  145.  
  146.  
  147.  
  148.      2.2  Operation System Dependent Features
  149.  
  150.      2.2.1  Kernel Resident Networking Software
  151.  
  152.           There are several features of the implementation  which  are
  153.      operating  system  dependent.  The most important of these is the
  154.      fact that the networking software is  being  implemented  in  the
  155.      UNIX kernel as a permanently resident system process, rather than
  156.      a swappable user level process.
  157.  
  158.           This organization has several  implications  which  bear  on
  159.      performance.    The   most  obvious  effect  is  that  since  the
  160.      networking software is always resident, it can  more  efficiently
  161.      respond  to  network  and  user initiated events, as it is always
  162.      available to service such events and need not be swapped in.   In
  163.      addition,  residence  in the kernel removes the burden of the use
  164.      of potentially inefficient interprocess communication mechanisms,
  165.      such  as  pipes and ports, since simpler data structures, such as
  166.      globally available queues, can be used to transmit  data  between
  167.      the network and user processes.  Kernel provided services, (e.g.,
  168.      timers and memory allocation) also become much  easier  and  more
  169.      efficient to use.
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.                                     -2-
  177.  
  178.      VAX-UNIX Networking                                 January, 1981
  179.      Support Project                                           IEN 168
  180.  
  181.  
  182.  
  183.           The large address space of the VAX makes  this  organization
  184.      practical  and  allows  the  avoidance of expedients like the NCP
  185.      split  kernel/user  process  implementation,   that   have   been
  186.      necessary  in  previous UNIX networking software on machines with
  187.      limited address space, like the PDP 11/70.  It is hoped that  the
  188.      kernel  resident  approach  will  contribute  to  the  speed  and
  189.      efficiency of this TCP.
  190.  
  191.  
  192.  
  193.      2.2.2  User Interface
  194.  
  195.           Use of the "traditional" UNIX file oriented  user  interface
  196.      is   another   operating   system   dependent   feature  of  this
  197.      implementation.  The user will access  the  network  software  by
  198.      means  of  standard system file I/O calls: open, close, read, and
  199.      write.  This entails modification of certain of  these  calls  to
  200.      accommodate  the  extra information needed to open and maintain a
  201.      connection.   In  addition,  the  communication  of   exceptional
  202.      conditions to the user (such as the foreign host going down) must
  203.      also be accommodated by extension of the standard  system  calls.
  204.      In  the  case  of open, for example, use of the call's mode field
  205.      will  be  extended  to  accommodate  a  pointer  to  a  parameter
  206.      structure.   In  the  case  of exceptional conditions, the return
  207.      code for reads and writes will be used to signal the presence  of
  208.      exceptional conditions, much like an error.  An additional status
  209.      call (ioctl) will be provided for the user to determine  detailed
  210.      information  about  the  nature of the condition, and the general
  211.      status of the connection.
  212.  
  213.           In this way, the necessary additional information needed  to
  214.      maintain  network  communications  will be supported, while still
  215.      allowing  the  use  of  the  functionality  that  the  UNIX  file
  216.      interface provides, such as the pipe mechanism.
  217.  
  218.           In the initial versions, this interface will be the standard
  219.      UNIX  blocking  I/O  mechanism.  Thus, outstanding reads for data
  220.      which has not been accepted from the  foreign  host,  and  writes
  221.      which  exceed the buffering resources of a connection will block.
  222.      It is  expected  that  the  await/capacity  mechanism,  currently
  223.      available  for  Version  6  systems, will be added to the VM/UNIX
  224.      kernel in the near future.  These non-blocking I/O  modifications
  225.      will be supported by the network software, relieving the blocking
  226.      restriction.
  227.  
  228.  
  229.  
  230.  
  231.  
  232.  
  233.  
  234.  
  235.                                     -3-
  236.  
  237.      VAX-UNIX Networking                                 January, 1981
  238.      Support Project                                           IEN 168
  239.  
  240.  
  241.  
  242.      3  Design Goals
  243.  
  244.           Several  design  goals  have  been   formulated   for   this
  245.      implementation.    Among  these  goals  are  efficiency  and  low
  246.      operating system overhead, promoted by a kernel resident  network
  247.      process,  which  allows  for  reduced  process  and  interprocess
  248.      communication overhead.
  249.  
  250.           Another goal of the implementation is to reduce  the  amount
  251.      of  extraneous  data  copying  in  handling  network traffic.  To
  252.      achieve this, a buffer data structure has been adopted which  has
  253.      the  following  characteristics:   intermediate size (128 bytes);
  254.      low overhead (10 bytes of control information  per  buffer);  and
  255.      flexibility  in  data handling through the use of data offset and
  256.      length fields, which reduce the amount of data  copying  required
  257.      for operations like IP fragment reassembly and TCP sequence space
  258.      manipulations.
  259.  
  260.           The use of queueing between the various software levels  has
  261.      been limited in the implementation by processing incoming network
  262.      data to the highest level possible as soon as possible.  Thus, an
  263.      unfragmented  message coming from the network is passed to the IP
  264.      and TCP levels, with queueing taking place at the  device  driver
  265.      only  until  the  message  has  been fully read from the network.
  266.      Similarly,  on  the  output  side,  data  transmission  is   only
  267.      attempted  when  the software is reasonably certain that the data
  268.      will be accepted by the network.
  269.  
  270.           Finally, it is planned that the  inclusion  of  the  network
  271.      software  will entail relatively little modification of the basic
  272.      kernel  code  beyond  that  provided  by  Berkeley.    The   only
  273.      modifications to kernel code outside the network software will be
  274.      slight changes to the file I/O system calls to support  the  user
  275.      interface  described  above.   In  addition,  an extension to the
  276.      virtual page map data structure in low core will be necessary  to
  277.      support  the  memory  allocation  scheme,  which makes use of the
  278.      kernel's page frame allocation mechanisms.
  279.  
  280.  
  281.  
  282.      4  Organization
  283.  
  284.      4.1  Control Flow
  285.  
  286.  
  287.  
  288.  
  289.  
  290.  
  291.  
  292.  
  293.  
  294.                                     -4-
  295.  
  296.      VAX-UNIX Networking                                 January, 1981
  297.      Support Project                                           IEN 168
  298.  
  299.  
  300.  
  301.      4.1.1  Local Network Interface
  302.  
  303.           The network software can be  viewed  as  a  kernel  resident
  304.      system  process,  much  like  the  scheduler  and  page daemon of
  305.      Berkeley VM/UNIX.  This process is initiated as part  of  network
  306.      initialization.   A diagram of its control and data flow is shown
  307.      in Figure 1.
  308.  
  309.  
  310.        |  |-----|           |-----|  |-----|  |-----|               |
  311.        |  |LOCAL|  |-----|  |LOCAL|  |     |  |     |               |
  312.        |  | NET |  |input|  | NET |  | IP  |  | TCP |               |
  313.        |->|INPUT|->|queue|->|INPUT|->|INPUT|->|INPUT|               |
  314.        |  | I/F |  |-----|  |     |  |     |  |     |               |
  315.      N |  |-----|==========>|-----|  |-----|  |-----|               |
  316.        |     ^    (wakeup)              ^        \    (timer)       |
  317.      E |     |                          |         \     /           | U
  318.        |  (input)                       V          \   /            |
  319.      T |  ( int )                    |-----|        \ /             | S
  320.        |                             |frag |      |-----|  |-----|  |
  321.      W |                             |queue|      |     |=>|     |->| E
  322.        |                             |-----|      | TCP |  |USER |  |
  323.      O |                      |-----||-----|      |MACH |  | I/F |  | R
  324.        |                      |unack|| snd |<---->|     |<=|     |<-|
  325.      R |  (outpt)             |queue||queue|      |-----|  |-----|  |
  326.        |  ( int )             |-----||-----|        / \       /     |
  327.      K |     |                                     /   \     /      |
  328.        |     V                                    /     \   /       |
  329.        |  |-----|           |-----|  |-----|  |-----|    \ /        |
  330.        |  |LOCAL|  |-----|  |LOCAL|  |     |  |     |  |-----|      |
  331.        |  | NET |  |outpt|  | NET |  | IP  |  | TCP |  | rcv |      |
  332.        |<-|OUTPT|<-|queue|<-|OUTPT|<-|OUTPT|<-|OUTPT|  |queue|      |
  333.        |  | I/F |  |-----|  |     |  |     |  |     |  |-----|      |
  334.        |  |-----|<----------|-----|  |-----|  |-----|               |
  335.        |                                                            |
  336.                       |                                   |
  337.                       |<----------TCP PROCESS------------>|
  338.                       |                                   |
  339.  
  340.                  Figure 1 . Network Software Organization
  341.  
  342.  
  343.      Its main flow of control is an input loop which is activated (via
  344.      wakeup)  by  the network interface device driver when an incoming
  345.      message has been completely read from the network.  (It can  also
  346.      be  awakened  by TCP user or timer events, described below.)  The
  347.      message is then taken from an input queue and dispatched  on  the
  348.      basis  of  local  network format (e.g., 1822 leader link number).
  349.      ARPANET imp-host messages (RFNMs, incompletes,  imp/host  status)
  350.  
  351.  
  352.  
  353.                                     -5-
  354.  
  355.      VAX-UNIX Networking                                 January, 1981
  356.      Support Project                                           IEN 168
  357.  
  358.  
  359.  
  360.      are  handled  at  this  level.   For other types of messages, the
  361.      local network level input handler  calls  higher  level  "message
  362.      handlers."   The  "standard  message  handler"  is  the  IP input
  363.      routine.  Handlers for other protocols at  this  level  (such  as
  364.      UNIX  NCP)  may  be accommodated in either of two ways.  First, a
  365.      "raw message" service is available which simply  queues  data  on
  366.      specified links to/from the local network.  By reading or writing
  367.      on a connection opened for  this  service,  a  user  process  may
  368.      handle    its    own   higher   level   protocol   communication.
  369.      Alternatively, for frequently used protocols, a new  handler  may
  370.      be defined in the kernel and called directly.
  371.  
  372.  
  373.  
  374.      4.1.2  Internet Protocol
  375.  
  376.           At the  IP  level,  the  fragment  reassembly  algorithm  is
  377.      executed.  Unfragmented messages with valid IP leaders are passed
  378.      to the higher level protocol handler in a manner similar  to  the
  379.      lower  level  dispatch,  but  on the basis of IP protocol number.
  380.      The  "standard  handler"  is  TCP.   Another   protocol   handler
  381.      interprets  IP  gateway-host  flow  control  and  routing  update
  382.      messages.
  383.  
  384.           Fragmented messages are  placed  on  a  fragment  reassembly
  385.      queue,  where  incoming  fragments  are  separated  by source and
  386.      destination  address,  protocol  number,  and  IP  identification
  387.      field.   For  each  "connection"  (as defined by these fields), a
  388.      linked list of fragments is maintained, tagged by fragment offset
  389.      start  and  end  byte  numbers.   As  fragments are received, the
  390.      proper list is found (or a new  one  is  created),  and  the  new
  391.      fragment  is  merged  in  by comparing start and end byte numbers
  392.      with those of fragments already on the list.  Duplicate  data  is
  393.      thrown  away.   A  timer  is  associated  with  this  queue,  and
  394.      incomplete messages which remain after timeout  are  dropped  and
  395.      their  storage  is  freed.   Completed messages are passed to the
  396.      next level.
  397.  
  398.  
  399.  
  400.      4.1.3  TCP Level
  401.  
  402.           At the TCP level, incoming datagrams are processed via calls
  403.      to  a  "TCP machine."  This is the TCP itself, which is organized
  404.      as a finite state machine whose states are  roughly  the  various
  405.      states  of  the  protocol  as  defined  in  [4], and whose inputs
  406.      include    incoming    data    from     the     network,     user
  407.      open/close/read/write  requests, and timer events. Input from the
  408.      network is handled directly, passing through the above  described
  409.  
  410.  
  411.  
  412.                                     -6-
  413.  
  414.      VAX-UNIX Networking                                 January, 1981
  415.      Support Project                                           IEN 168
  416.  
  417.  
  418.  
  419.      levels.   User  requests  and  timer events are handled through a
  420.      work queue.
  421.  
  422.           When a user process executes a network  request  via  system
  423.      call,  the relevant data (on a read or write) is copied from user
  424.      to kernel space (or vice versa), a work entry  is  enqueued,  and
  425.      the   network   process  is  awakened.   Similarly,  when  timers
  426.      associated with TCP (such as the retransmission  timer)  go  off,
  427.      timer work requests are enqueued and the network input process is
  428.      awakened.  Once awakened, it checks for the presence of completed
  429.      messages  from  the  network interface and processes them.  After
  430.      these inputs are processed, the TCP machine is called  to  handle
  431.      any  outstanding requests on the work queue.  The network process
  432.      then sleeps, waiting for more network  input  or  work  requests.
  433.      Thus,  the TCP machine may be called directly with network input,
  434.      or awakened indirectly to check its work queue for user and timer
  435.      requests.
  436.  
  437.           After reset  processing  and  sequence  and  acknowledgement
  438.      number  validation,  acceptable  received  data  is sequenced and
  439.      placed on the receive queue. This sequencing process  is  similar
  440.      to  the  IP  fragment reassembly algorithm described above.  Data
  441.      placed on  this  queue  is  acknowledged  to  the  foreign  host.
  442.      Received  data  whose  sequence  numbers  lie outside the current
  443.      receive  window  are  not  processed,  but  are  placed   on   an
  444.      unacknowledged  message  queue.  The advertised receive window is
  445.      determined on the basis of  the  remaining  amount  of  buffering
  446.      allocated  to the connection (see below).  When buffering becomes
  447.      available, data on  the  unacknowledged  message  queue  is  then
  448.      processed and placed on the receive data queue.
  449.  
  450.           On the output  side,  TCP  requests  for  data  transmission
  451.      result  in  calls  to  the IP level output routine.  This routine
  452.      does fragmentation, if necessary, and makes calls  on  the  local
  453.      network  output  routine.  Outgoing messages are then placed on a
  454.      buffering queue, for transmission to the network interface by the
  455.      device  driver.   In  data  transmission,  an  attempt is made to
  456.      ensure that data moving from the highest level (TCP), will not be
  457.      sent  unless  there is reasonable certainty that the lower levels
  458.      will have the necessary  resources  to  accept  the  message  for
  459.      transmission to the network.
  460.  
  461.           All data to be sent is maintained on a  single  send  queue,
  462.      where  data  is  added  on  user  writes, and removed when proper
  463.      acknowledgement is received.   Whenever  the  TCP  machine  sends
  464.      data,  a  retransmission timer is set, and the sequence number of
  465.      the first data  byte  on  the  queue  is  saved.   After  initial
  466.      transmission  the  sequence  number  of  the next data to send is
  467.      advanced beyond what was first sent.  If the retransmission timer
  468.  
  469.  
  470.  
  471.                                     -7-
  472.  
  473.      VAX-UNIX Networking                                 January, 1981
  474.      Support Project                                           IEN 168
  475.  
  476.  
  477.  
  478.      goes off before that data is acknowledged, the sequence number of
  479.      the next data to send is backed up, and the contents of the  send
  480.      buffer  (for the length determined by the current send window) is
  481.      retransmitted, with the ACK and window fields set  appropriately.
  482.      The  retransmission  timer is set with increasingly higher values
  483.      from 3 to 30 seconds, if  the  saved  sequence  number  does  not
  484.      advance.
  485.  
  486.           A persistence timer is also set when  data  is  sent.   This
  487.      allows  communication  to  be  maintained  if the foreign process
  488.      advertises a zero length window.  When the persistence timer goes
  489.      off, one byte of data is forced out of the TCP.
  490.  
  491.  
  492.  
  493.      4.2  Buffering Strategy
  494.  
  495.           As mentioned earlier, all data is passed from the network to
  496.      the  various  protocol software layers in intermediate sized (128
  497.      byte) buffers. The  buffers  have  two  chain  pointers,  a  data
  498.      offset,  and a data length field (see Figure 2).  As data is read
  499.      from the network or copied from the user,  multiple  buffers  are
  500.      chained  together.   Protocol  headers  are  also  held  in these
  501.      buffers.  As messages are passed  between  the  various  software
  502.      levels,  the  offset  is  modified  to  point  at the appropriate
  503.      header.  The length field gives the end of data in  a  particular
  504.      buffer.   This offset/length pair facilitates merging of messages
  505.      in IP fragment reassembly and TCP sequencing.
  506.  
  507.           The allocation of these buffers is handled  by  the  network
  508.      software.   Buffers  are  obtained by "stealing" page frames from
  509.      the kernel's free memory map  (CMAP).   In  VM/UNIX,  these  page
  510.      frames are 1024 bytes long, and thus have room for eight 128 byte
  511.      buffers.  The advantage of using kernel paging memory as a source
  512.      of  network  buffers is that their allocation can be done totally
  513.      dynamically, with little effect on the operation of  the  overall
  514.      system.   Buffers are allocated from a cache of free page frames,
  515.      maintained  on  a  circular  free  list  by  the  network  memory
  516.      allocator.   As the demand for buffers increases, new page frames
  517.      are stolen from the paging freelist  and  added  to  the  network
  518.      buffer  cache.  Similarly,  as  the need for pages decrease, free
  519.      pages are returned to the system.  To minimize  fragmentation  in
  520.      buffer  allocation  within  the  page  frames,  the  free list is
  521.      sorted.  When no more pages are available for allocation, data on
  522.      the IP reassembly and TCP unacknowledged data queues are dropped,
  523.      and their buffers are recycled.
  524.  
  525.  
  526.  
  527.  
  528.  
  529.  
  530.                                     -8-
  531.  
  532.      VAX-UNIX Networking                                 January, 1981
  533.      Support Project                                           IEN 168
  534.  
  535.  
  536.  
  537.  
  538.  
  539.  
  540.                  ^    |------------------------|    ^
  541.                  |    |    -> NEXT BUFFER      |    |
  542.                 10    |------------------------|    |
  543.                BYTES  |      QUEUE LINK        |    |
  544.                  |    |-----------|------------|    |
  545.                  V    |  OFFSET   |  LENGTH    |    |
  546.                       |-----------|------------|    |
  547.                       |                        |   128
  548.                       |                        |  BYTES
  549.                       |                        |    |
  550.                       |        D A T A         |    |
  551.                       |                        |    |
  552.                       |                        |    |
  553.                       |                        |    |
  554.                       |                        |    |
  555.                       |------------------------|    V
  556.  
  557.  
  558.                    Figure 2 . Layout of a Network Buffer
  559.  
  560.  
  561.           The number of pages that can be stolen from  the  system  is
  562.      limited  to  a  moderate number (in practice 64-256, depending on
  563.      network utilization in a particular system).  To enforce fairness
  564.      of  network  resource utilization between connections, the number
  565.      of buffers that can be dedicated to a  particular  connection  at
  566.      any  time  is  limited.   This  limit can be varied to some small
  567.      degree by the user when a connection is opened.  Thus,  a  TELNET
  568.      user  may open a connection with the minimum 1K bytes of send and
  569.      receive  buffering;  while  an  FTP  user,  anticipating   larger
  570.      transfers,  might  desire  up  to 4K of buffering.  The effect of
  571.      this connection buffering allocation is to place a limit  on  the
  572.      amount  of data that the TCP may accept from the user for sending
  573.      before blocking, and the amount of input from  the  network  that
  574.      the  TCP  may  acknowledge.   Note that in receiving, the network
  575.      software  may  allocate  available  buffers  beyond  the   user's
  576.      connection  limit  for  incoming  data.   However,  this  data is
  577.      considered volatile, and may be dropped when  buffer  demands  go
  578.      higher.   Incoming  data  is  acknowledged  by TCP only until the
  579.      user's connection buffer limit is exhausted.  The advertised  TCP
  580.      flow  control  window for a connection is set on the basis of the
  581.      remaining amount of this buffering.
  582.  
  583.           Thus, the network software must insure that  it  has  enough
  584.      buffering  for  1) its own internal use in processing data on the
  585.      IP and local network levels; 2) retaining acknowledged  TCP  data
  586.  
  587.  
  588.  
  589.                                     -9-
  590.  
  591.      VAX-UNIX Networking                                 January, 1981
  592.      Support Project                                           IEN 168
  593.  
  594.  
  595.  
  596.      that  have  not  been copied to user space; and 3) retaining data
  597.      accepted by the TCP for transmission  which  have  not  yet  been
  598.      acknowledged  by  the  foreign  host  TCP.   Other  data, such as
  599.      unacknowledged TCP input from the network and fragments on the IP
  600.      reassembly  queue are vulnerable to being dropped when demand for
  601.      more buffers makes necessary the recycling of  buffers  on  these
  602.      queues.   Since  there is an absolute limit on the number of page
  603.      frames that may be stolen from the paging system, and  hence  the
  604.      total  number of buffers available, there is a resultant limit on
  605.      the total number of simultaneous connections.
  606.  
  607.           Several data  structures  are  required  for  stealing  page
  608.      frames  from  the  kernel  and  maintaining the buffer free list.
  609.      These include enough page table entries for mapping  the  maximum
  610.      number  of  page  frames  which can be stolen from the system, an
  611.      allocation map for allocating these page table entries,  and  the
  612.      free  page list itself.  For a 256 page maximum, this requires 2K
  613.      bytes of page tables, 1K bytes for page frame allocation mapping,
  614.      and  another 1K bytes for the network freelist.  The maximum page
  615.      parameter and others, including the minimum and maximum amount of
  616.      buffering  that  the user may specify are modifiable constants of
  617.      the implementation.
  618.  
  619.  
  620.  
  621.      4.3  Data Structures
  622.  
  623.           Along with the data structures needed to support the  buffer
  624.      management  system,  there are several others used in the network
  625.      software (see Figure 3).  The  focus  of  activity  is  the  user
  626.      connection block (UCB), and the TCP control block (TCB).  The UCB
  627.      is allocated from a table on a per connection  basis.   It  holds
  628.      non-protocol specific information to maintain a connection.  This
  629.      includes a pointer the UNIX process structure of the opener of  a
  630.      connection, (2) a pointer to the foreign host entry for the  peer
  631.      process's  host,  a  pointer  to the protocol-specific connection
  632.      control block (for TCP, the TCB), pointers to the user's send and
  633.      receive  data  buffer  chain,  and miscellaneous flags and status
  634.      information.   When a network connection is opened, an  entry  in
  635.      the user's open file table is allocated, which holds a pointer to
  636.      the UCB.
  637.  
  638.           For TCP connections, a  TCB  is  allocated.   All  TCBs  are
  639.      chained   together  to  facilitate  buffer  recycling.   The  TCB
  640.      contains a pointer to the corresponding UCB, a block of  sequence
  641.      number  variables  and  state  flags used by the TCP finite state
  642.      _______________
  643.      (2) For details on data structures specific to UNIX, see [5].
  644.  
  645.  
  646.  
  647.  
  648.                                    -10-
  649.  
  650.      VAX-UNIX Networking                                 January, 1981
  651.      Support Project                                           IEN 168
  652.  
  653.  
  654.  
  655.  
  656.  
  657.                                                    Foreign
  658.                                                   Host Table
  659.                                                   |--------|
  660.                               Network     |------>|Host Adr|
  661.                              Conn Table   |       |--------|
  662.                              |--------|   |       | #RFNM  |
  663.                         |--->|->Proc  |<--+--|    |--------|
  664.                         |    |--------|   |  |    | Status |
  665.                         |    |->Host  |---|  |    |--------|
  666.             Per User    |    |--------|      |
  667.            File Table   |    | ->TCB  |---|  |       TCB
  668.            |--------|   |    |--------|   |  |    |--------|
  669.            | Flags  |   |    |->S Buf |   |--+--->| ->next |
  670.            |--------|   |    |--------|      |    |--------|
  671.            | ->UCB  |---|    |->R Buf |      |----| ->UCB  |
  672.            |--------|        |--------|           |--------|
  673.                              | Flags  |           |  FSM   |
  674.                              |  and   |           |Sequence|
  675.                              | Status |           |  Vars  |
  676.                              |--------|           |--------|
  677.                                                   |->Snd Q |
  678.                                                   |--------|
  679.                                                   |->Rcv Q |
  680.                                                   |--------|
  681.                                                   |->UnackQ|
  682.                                                   |--------|
  683.                                                   | Flags  |
  684.                                                   |  and   |
  685.                                                   | Status |
  686.                                                   |--------|
  687.  
  688.  
  689.                     Figure 3 . Network Data Structures
  690.  
  691.  
  692.      machine, pointers to the various TCP data queues, and  flags  and
  693.      state  variables.   Protocols other than TCP would have their own
  694.      control blocks instead of the TCB.  For the "raw"  local  network
  695.      and IP handlers, all necessary information is kept in the UCB.
  696.  
  697.           Finally, there is a foreign host table,  where  entries  are
  698.      allocated  for each host that is part of a connection.  The entry
  699.      contains the foreign  host's  internet  address,  the  number  of
  700.      outstanding RFNM's for 1822 level host-imp communication, and the
  701.      status of the foreign host.  Entries in this table are hashed  on
  702.      the foreign host address.
  703.  
  704.  
  705.  
  706.  
  707.                                    -11-
  708.  
  709.      VAX-UNIX Networking                                 January, 1981
  710.      Support Project                                           IEN 168
  711.  
  712.  
  713.  
  714.      5  References
  715.  
  716.      [1]  Babaoglu,  O.,  W.  Joy,  and   J.   Porcar,   "Design   and
  717.           Implementation  of the Berkeley Virtual Memory Extensions to
  718.           the UNIX Operating System," Computer Science Division, Dept.
  719.           of  Electrical  Engineering and Computer Science, University
  720.           of California, Berkeley, December, 1979.
  721.  
  722.      [2]  Bolt   Beranek   and   Newman,   "Specification   for    the
  723.           Interconnection  of  a  Host  and an IMP,"  Bolt Beranek and
  724.           Newman Inc., Report No. 1822, May 1978 (Revised).
  725.  
  726.      [3]  Postel, J. (ed.), "DoD Standard Internet Protocol,"  Defense
  727.           Advanced  Research  Projects  Agency, Information Processing
  728.           Techniques Office, RFC 760, IEN 128, January, 1980.
  729.  
  730.      [4]  Postel,  J.  (ed.),  "DoD  Standard   Transmission   Control
  731.           Protocol,"   Defense   Advanced  Research  Projects  Agency,
  732.           Information Processing Techniques Office, RFC 761, IEN  129,
  733.           January, 1980.
  734.  
  735.      [5]  Thompson,  K.,  "UNIX  Implementation,"  The   Bell   System
  736.           Technical Journal, 57 (6), July-August, 1978, pp. 1931-1946.
  737.  
  738.  
  739.  
  740.  
  741.  
  742.  
  743.  
  744.  
  745.  
  746.  
  747.  
  748.  
  749.  
  750.  
  751.  
  752.  
  753.  
  754.  
  755.  
  756.  
  757.  
  758.  
  759.  
  760.  
  761.  
  762.  
  763.  
  764.  
  765.  
  766.                                    -12-
  767.  
  768.      VAX-UNIX Networking                                 January, 1981
  769.      Support Project                                           IEN 168
  770.  
  771.  
  772.  
  773.                              Table of Contents
  774.  
  775.  
  776.  
  777.  
  778.      1   Introduction.......................................... 1
  779.      2   Features of the Implementation........................ 1
  780.      2.1   Protocol Dependent Features......................... 1
  781.      2.1.1   Separation of Protocol Layers..................... 1
  782.      2.1.2   Protocol Functions................................ 2
  783.      2.2   Operation System Dependent Features................. 2
  784.      2.2.1   Kernel Resident Networking Software............... 2
  785.      2.2.2   User Interface.................................... 3
  786.      3   Design Goals.......................................... 4
  787.      4   Organization.......................................... 4
  788.      4.1   Control Flow........................................ 4
  789.      4.1.1   Local Network Interface........................... 5
  790.      4.1.2   Internet Protocol................................. 6
  791.      4.1.3   TCP Level......................................... 6
  792.      4.2   Buffering Strategy.................................. 8
  793.      4.3   Data Structures.................................... 10
  794.      5   References........................................... 12
  795.  
  796.  
  797.  
  798.  
  799.  
  800.  
  801.  
  802.  
  803.  
  804.  
  805.  
  806.  
  807.  
  808.  
  809.  
  810.  
  811.  
  812.  
  813.  
  814.  
  815.  
  816.  
  817.  
  818.  
  819.  
  820.  
  821.  
  822.  
  823.  
  824.  
  825.                                     -i-
  826.  
  827.